<?php
$hotel_ID = $_POST['hidden_booking_hotelid'];
?>
<script type="text/javascript" src="<?php bloginfo('template_url');?>/js/mybookinghotel.js"></script>	
	 		<style>
				 p label.contact_error
				{
					display:none;
				}
				 p label.contact_error_show
				{
					display:block;
					color:red;
					font-weight:bold;
					float:left;
					margin-left:5px;
					width:20px;
					float:left;
				}
			</style>
<div id="content-right">
        	
           	<!--begin box - content-->
			<div class="gioi-thieu tientrinh1">
            <span class="iconhome"></span>
            <div class="btbreakcumb">
            <?php bt_breadcrumb();?>
            </div>
	            <h1>Booking hotel</h1>                
                <ul class="bgtientrinh">
          <li class="current-page-item page-item ht"><span>Hotels Information</span></li>
          <li class="page-item cm"><span>Customer Information</span></li>
          <li class=" page-item cr"><span>Credit Card For The Booking Payment</span></li>
        </ul>
		        <div class="clear"></div>
        		<form action="" method="post">        		
                <p><label class="ten">Type room: <span class="red">*</span></label>
                	<?php 
                            	//$hotel_price = db_select_all_data("hotel_price");                            	
                            	$hotel_price = db_select_all_data_by_hotelID("hotel_price",$hotel_ID);
                            	?>
                                <select name="type_room" id="type_room" style="float: left;">
                                	<option value="">Type room</option>
                                	<?php
                                	if($hotel_price)
                                	{
										foreach ($hotel_price as $value) 
										{	
											$key = db_get_key_type_room($value->typeroom);	
											if(isset($_SESSION['my_booking_true_friends']) && $_SESSION['my_booking_true_friends']['sidebar_type_room']==$key)
											{
												?>
												<option selected="selected" value="<?php echo $key;?>"><?php echo $value->typeroom;?></option>
												<?php 
											}	
											else 
											{							
												?>
												<option value="<?php echo $key;?>"><?php echo $value->typeroom;?></option>
												<?php 
											}
										}
                                	} 
									?>
                                </select>
                                <label id="contact_error_type_room" class="contact_error">*</label>
                </p>
                <p><label class="ten">Adults: <span class="red">*</span></label>
                	<select name="adults" id="adults">
                       	    	<?php
                       	    	for($i=1;$i<=10;$i++)
                       	    	{
                       	    		if(isset($_SESSION['my_booking_true_friends']) && $_SESSION['my_booking_true_friends']['sidebar_adults']==$i)
                       	    		{
                       	    		?>
                       	    		<option selected="selected" value="<?php echo $i;?>"><?php echo $i;?></option>
                       	    		<?php 	
                       	    		}
                       	    		else 
                       	    		{
                       	    		?>
                       	    		<option value="<?php echo $i;?>"><?php echo $i;?></option>
                       	    		<?php	
                       	    		}
                       	    	} 
                       	    	?>                       	    		
                       	    	</select>
                </p>
                <p><label class="ten">Number of rooms: <span class="red">*</span></label>
                	<select name="number_of_room" id="number_of_room">
                       	    	<?php
                       	    	for($i=1;$i<=10;$i++)
                       	    	{
                       	    		if(isset($_SESSION['my_booking_true_friends']) && $_SESSION['my_booking_true_friends']['sidebar_number_of_room']==$i)
                       	    		{
                       	    		?>
                       	    		<option selected="selected" value="<?php echo $i;?>"><?php echo $i;?></option>
                       	    		<?php 	
                       	    		}
                       	    		else 
                       	    		{
                       	    		?>
                       	    		<option value="<?php echo $i;?>"><?php echo $i;?></option>
                       	    		<?php	
                       	    		}
                       	    	} 
                       	    	?>                       	    		
                       	    	</select>
                </p>
                <p><label class="ten">Check in date: <span class="red">*</span></label>
                	<?php                		
                            	if(isset($_SESSION['my_booking_true_friends']) && $_SESSION['my_booking_true_friends']['demo1']!=null)
                            	{
                            		$date1 = $_SESSION['my_booking_true_friends']['demo1'];                            		
                					$date1 = explode("-", $date1);
                					//print_r($date1);
                            		$newDate_ID 	= $date1[1];
                            		$newDate_IM 	= $date1[0];
                            		$newDate_IY 	= $date1[2];            		
                            		
                            	}
                            	else 
                            	{
                            		 $originalDate = date('Y-m-d h:i:s');                                                
                                                $newDate_IY = date("Y", strtotime($originalDate));
                                                $newDate_IM = date("m", strtotime($originalDate));
                                                $newDate_ID = date("d", strtotime($originalDate));
                            	}
                                                                                    
                                            ?>
                                            <?php
                                            $date = date('Y');
                                            ?>
                                <select name="dy_check_in_date" id="dy_check_in_date">
                                	<?php
                    							for($i = 1;$i<=30;$i++)
                    							{
                    								if($i == $newDate_ID)
                    								{
                    								?>
                    									<option selected="selected" value="<?php echo $i;?>"><?php echo $i;?></option>
                    								<?php	
                    								}
                    								else 
                    								{
                    							?>
                    								<option value="<?php echo $i;?>"><?php echo $i;?></option>
                    							<?php
                    								} 								
                    							}	 
                    							?>	
                                </select>
                                <select name="mo_check_in_date" id="mo_check_in_date">
                                	<option <?php if($newDate_IM == 1) echo 'selected="selected"';?> value="01">January </option>
                                                <option <?php if($newDate_IM == 2) echo 'selected="selected"';?> value="02">February </option>
                                                <option <?php if($newDate_IM == 3) echo 'selected="selected"';?> value="03">March </option>
                                                <option <?php if($newDate_IM == 4) echo 'selected="selected"';?> value="04">April </option>
                                                <option <?php if($newDate_IM == 5) echo 'selected="selected"';?> value="05">May </option>
                                                <option <?php if($newDate_IM == 6) echo 'selected="selected"';?> value="06">June </option>
                                                <option <?php if($newDate_IM == 7) echo 'selected="selected"';?> value="07">July </option>
                                                <option <?php if($newDate_IM == 8) echo 'selected="selected"';?> value="08">August </option>
                                                <option <?php if($newDate_IM == 9) echo 'selected="selected"';?> value="09">September </option>
                                                <option <?php if($newDate_IM == 10) echo 'selected="selected"';?> value="10">October </option>
                                                <option <?php if($newDate_IM == 11) echo 'selected="selected"';?> value="11">November </option>
                                                <option <?php if($newDate_IM == 12) echo 'selected="selected"';?> value="12">December </option>
                                </select>
                                <select name="yr_check_in_date" id="yr_check_in_date">
                                	<?php                    								
                    								for($y = $date; $y <= $date+5 ; $y++)
                    								{
                    									if($y == $newDate_IY)
                    									{
                    									?>
                    										<option selected="selected" value="<?php echo $y;?>"> <?php echo $y;?> </option>
                    									<?php 										
                    									}
                    									else 
                    									{
                    									?>
                    										<option value="<?php echo $y;?>"> <?php echo $y;?> </option>
                    									<?php 	
                    									}					
                    								}				
                    							?>
                                </select>
                                <label id="contact_error_check_in" class="contact_error">*</label>
                </p>
                <p><label class="ten">Check out date: <span class="red">*</span></label>
                	<?php
                            	
                            	if(isset($_SESSION['my_booking_true_friends']) && $_SESSION['my_booking_true_friends']['demo2']!=null)
                            	{
                            		$date1 = $_SESSION['my_booking_true_friends']['demo2'];                            		
                					$date1 = explode("-", $date1);
                					//print_r($date1);
                            		$newDate_ID 	= $date1[1];
                            		$newDate_IM 	= $date1[0];
                            		$newDate_IY 	= $date1[2];            		
                            		
                            	}
                            	else 
                            	{
                            		$originalDate = date('Y-m-d h:i:s');
                                                
                                                $newDate_IY = date("Y", strtotime($originalDate));
                                                $newDate_IM = date("m", strtotime($originalDate));
                                                $newDate_ID = date("d", strtotime($originalDate));  
                            	}
                            	
                                                                                   
                                            ?>
                                            <?php
                                            $date = date('Y');
                                            ?>
                                <select name="dy_check_out_date" id="dy_check_out_date">
                                	<?php
                    							for($i = 1;$i<=30;$i++)
                    							{
                    								if($i == $newDate_ID)
                    								{
                    								?>
                    									<option selected="selected" value="<?php echo $i;?>"><?php echo $i;?></option>
                    								<?php	
                    								}
                    								else 
                    								{
                    							?>
                    								<option value="<?php echo $i;?>"><?php echo $i;?></option>
                    							<?php
                    								} 								
                    							}	 
                    							?>	
                                </select>
                                <select name="mo_check_out_date" id="mo_check_out_date">
                                	<option <?php if($newDate_IM == 1) echo 'selected="selected"';?> value="01">January </option>
                                                <option <?php if($newDate_IM == 2) echo 'selected="selected"';?> value="02">February </option>
                                                <option <?php if($newDate_IM == 3) echo 'selected="selected"';?> value="03">March </option>
                                                <option <?php if($newDate_IM == 4) echo 'selected="selected"';?> value="04">April </option>
                                                <option <?php if($newDate_IM == 5) echo 'selected="selected"';?> value="05">May </option>
                                                <option <?php if($newDate_IM == 6) echo 'selected="selected"';?> value="06">June </option>
                                                <option <?php if($newDate_IM == 7) echo 'selected="selected"';?> value="07">July </option>
                                                <option <?php if($newDate_IM == 8) echo 'selected="selected"';?> value="08">August </option>
                                                <option <?php if($newDate_IM == 9) echo 'selected="selected"';?> value="09">September </option>
                                                <option <?php if($newDate_IM == 10) echo 'selected="selected"';?> value="10">October </option>
                                                <option <?php if($newDate_IM == 11) echo 'selected="selected"';?> value="11">November </option>
                                                <option <?php if($newDate_IM == 12) echo 'selected="selected"';?> value="12">December </option>
                                </select>
                                <select name="yr_check_out_date" id="yr_check_out_date">
                                	<?php                    								
                    								for($y = $date; $y <= $date+5 ; $y++)
                    								{
                    									if($y == $newDate_IY)
                    									{
                    									?>
                    										<option selected="selected" value="<?php echo $y;?>"> <?php echo $y;?> </option>
                    									<?php 										
                    									}
                    									else 
                    									{
                    									?>
                    										<option value="<?php echo $y;?>"> <?php echo $y;?> </option>
                    									<?php 	
                    									}					
                    								}				
                    							?>
                                </select>
                                <label id="contact_error_check_out" class="contact_error">*</label>
                </p>
                 <p>
                            	<label class="ten">Price :</label>
                            	<?php
                            	//$hotel_price = get_post_meta($hotel_ID, $wpdb->prefix.'price',true);
                            	//print_r($hotel_price);
                            	 if($hotel_price)
                                	{
										foreach ($hotel_price as $value) 
										{	
											$price = $value->max.'*|*'.$value->totalofroom.'*|*'.$value->roomempty.'*|*'.$value->ratefornight;
											$mykey = intval(db_get_key_type_room($value->typeroom));
											$myname = "hotel_price_name_".$mykey;										
											?>
											<input type="hidden" name="<?php echo $myname;?>" id="<?php echo $myname;?>" value="<?php echo $price;?>">
											<?php 
											
										}
                                	} 
                            	?>
                                <!-- <span class="price"><?php //echo $hotel_price;?> USD</span> -->
                                <input readonly="readonly" style="border: none; font-weight: bold; color: #666; width: 45px;" class="price" name="hotel_price_show" id="hotel_price_show" value="">USD
                                <input type="hidden" name="hidden_hotel_price" id="hidden_hotel_price" value="">
                            </p>
                            <p>
                            	<label class="ten">Deposit :</label>
                            	<?php
                            	$deposit_hotel = db_type_room_list();
                            	foreach ($deposit_hotel as $key=>$value) 
                            	{
                            		$key+=1;
                            		//$key_depo = "hotel_deposit_name_".$key;
                            		$depost = get_option("hotel_deposit_name_".$key);
                            		?>
                            		<input type="hidden" name="hotel_deposit_name_<?php echo $key;?>" id="hotel_deposit_name_<?php echo $key;?>" value="<?php echo $depost;?>">
                            		<?php 
                            	}
                            	?>
                                <!-- <span class="price">1000 USD</span> -->
                                <input readonly="readonly" style="border: none; font-weight: bold; color: #666; width: 45px;" class="price" name="hotel_deposit_show" id="hotel_deposit_show" value="">USD
                                <input type="hidden" name="hidden_hotel_deposit" id="hidden_hotel_deposit" value="">
                                 <input type="submit" id="submit_book_hotel_step1" value="Next" />
                    			<input type="hidden" name="mybooking" value="hotels"/>
                    			<input type="hidden" name="hotelidbooking" value="<?php echo $hotel_ID;?>">
                            </p>
                    <!--         
                <p><label class="ten">Deposit: <span class="red">*</span></label>
					<span class="red">500 USD</span>
                    <input type="submit" value="Next" />
                    <input type="hidden" name="mybooking" value="hotels"/> 
                </p>
                -->
                <?php wp_nonce_field('act_activation_booking_go2','act_activation_booking_go2');?>
                </form>
				
            </div>
            
        
        </div>